home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / pdcurs21 / tui.h < prev   
C/C++ Source or Header  |  1993-06-13  |  2KB  |  75 lines

  1. /*
  2.  * File   : tui.h      'textual user interface'
  3.  * Author : P.J. Kunst  (kunst@prl.philips.nl)
  4.  * Date   : 25-02-93
  5.  * Version: 1.02
  6.  */
  7.  
  8. #ifndef _TUI_H_
  9. #define _TUI_H_
  10.  
  11. #include <curses.h>
  12.  
  13. #ifndef getbegyx
  14. #define getbegyx(w,y,x)        ( y = (w)->_begy, x = (w)->_begx )
  15. #endif
  16. #ifndef getmaxyx
  17. #define getmaxyx(w,y,x)        ( y = (w)->_maxy, x = (w)->_maxx )
  18. #endif
  19.  
  20. #ifdef A_COLOR
  21. #define A_ATTR  (A_ATTRIBUTES ^ A_COLOR)  /* A_BLINK, A_REVERSE, A_BOLD */
  22. #else
  23. #define A_ATTR  (A_ATTRIBUTES)            /* standard UNIX attributes */
  24. #endif
  25.  
  26.  
  27. #define MAXSTRLEN  256
  28. #define KEY_ESC    0x1b     /* Escape */
  29.  
  30. typedef void (*FUNC)(void);
  31.  
  32. typedef struct 
  33. {
  34.   char *name;   /* item label */
  35.   FUNC  func;   /* (pointer to) function */
  36.   char *desc;   /* function description */
  37. } menu;
  38.  
  39. /* ANSI C function prototypes: */
  40.  
  41. void    clsbody    (void);
  42. int     bodylen    (void);
  43. WINDOW *bodywin    (void);
  44.  
  45. void    rmerror    (void);
  46. void    rmstatus   (void);
  47.  
  48. void    titlemsg   (char *msg);
  49. void    bodymsg    (char *msg);
  50. void    errormsg   (char *msg);
  51. void    statusmsg  (char *msg);
  52.  
  53. bool    keypressed (void);
  54. chtype  getkey     (void);
  55. void    flushkeys  (void);
  56. chtype  waitforkey (void);
  57.  
  58. void    DoExit     (void);
  59. void    startmenu  (menu *mp, char *title);
  60. void    domenu     (menu *mp);
  61.  
  62. chtype  weditstr   (WINDOW *win, char *buf, int field);
  63. WINDOW *winputbox  (WINDOW *win, int nlines, int ncols);
  64. chtype  getstrings (const char *desc[], char *buf[], int field);
  65.  
  66. #define editstr(s,f)           (weditstr(stdscr,s,f))
  67. #define mveditstr(y,x,s,f)     (move(y,x)==ERR?ERR:editstr(s,f))
  68. #define mvweditstr(w,y,x,s,f)  (wmove(w,y,x)==ERR?ERR:weditstr(w,s,f))
  69.  
  70. #define inputbox(l,c)          (winputbox(stdscr,l,c))
  71. #define mvinputbox(y,x,l,c)    (move(y,x)==ERR?w:inputbox(l,c))
  72. #define mvwinputbox(w,y,x,l,c) (wmove(w,y,x)==ERR?w:winputbox(w,l,c))
  73.  
  74. #endif
  75.